<?php

namespace app\adminapi\controller;

use think\Controller;
use think\facade\Request;
use app\adminapi\model\Auth as authtable;
use think\console\output\descriptor\Console;

class Auth extends BaseApi
{
    // 查询数据
    public function index(){
        // 测试
        // $this->ok("sbhd");
        $list=authtable::select();
        $list=get_tree_list($list->toArray());
        $data=$list;
        $this->ok($data);
        
        // //接受参数
        // $param=Request::param();
        // //查询数据
        // $pageSize=$param['pageSize'];
        // if(!empty($param['keyword'])){
        //     $keyword=$param['keyword'];
        //     // $data=roletable::where('role_name','like',"%$keyword%")->paginate($pageSize);
        //     $data=authtable::alias('t1')->join('pyg_auth t2','t1.`role_auth_id`=t2.`id`','left')
        //     ->field('t1.*,t2.auth_name')->where('role_name','like',"%$keyword%")->paginate($pageSize);
        // }else{
        //     // $data=roletable::paginate($pageSize);
        //     $data=authtable::alias('t1')->join('pyg_auth t2','t1.role_auth_id=t2.id','left')
        //     ->field('t1.*,t2.auth_name')->paginate($pageSize);
        // }
        // $this->ok($data);

    }
    // 添加权限
    public function add(){
        
        // $this->ok("sbhd11111");
        $param=Request::param();
                // dump($param);
                
        // authtable::insert([
        //             'auth_name'=>$param['auth_name'],
        //             'auth_c'=>$param['auth_c'],
        //             'auth_a'=>$param['auth_a'],
        //             'is_nav'=>$param['is_nav'],
        //             'level'=>$param['level'],
        //             ]);
                    $this->ok($param);
    }

}
